﻿#include "stdafx.h"
#include "XRadioBoxIntParser.h"

#include "XBSTR.h"
#include "Util.h"
#include "IXRadioBox.h"

#include "ParseHelper.h"


CXRadioBoxIntParser::CXRadioBoxIntParser() : CXIntParserBase(&TIntCreateControl<IXRadioBox>)
{
    ;
}

CXRadioBoxIntParser::~CXRadioBoxIntParser()
{
    ;
}

// 填充属性
BOOL CXRadioBoxIntParser::FillAttr(IN IXConfigNode* pNode, IN IXControl* pControl)
{
    BOOL bResult = m_ParentParser.FillAttr(pNode, pControl);
    if(!bResult)
        return bResult;

    XBSTR bstrTemp;
    BOOL bTemp;

    IXRadioBox* pRadioBox = Util::QueryIntf<IXRadioBox>(pControl);
    if(pRadioBox == NULL)
        return FALSE;

    // GroupName
    if(SUCCEEDED(pNode->GetValue(_T("group"), &bstrTemp)))
    {
        pRadioBox->put_GroupName(bstrTemp);
    }

    // Check
    if(SUCCEEDED(pNode->GetValue(_T("check"), &bTemp)))
    {
        pRadioBox->put_Check(bTemp);
    }

    // ScaleImage
    if(SUCCEEDED(pNode->GetValue(_T("scale"), &bTemp)))
    {
        pRadioBox->put_ScaleImage(bTemp);
    }

    return bResult;
}
